<html>
<head>
    <css file="__PUBLIC__/css/body.css"/>
    <css file="__STATIC__/icon/icon.css"/>
    <css file="__PUBLIC__/css/tab.css"/>
    <js file="__STATIC__/jquery-1.7.2.min.js"/>
    <css file="__STATIC__/kindeditor/themes/default/default.css" />
    <js file="__STATIC__/kindeditor/kindeditor-min.js"/>
    <js file="__STATIC__/kindeditor/lang/zh_CN.js"/>
    <css file="__STATIC__/uploadify/uploadify.css"/>
    <js file="__STATIC__/uploadify/jquery.uploadify.js"/>
    <script type="text/javascript">
        function cc(obj)
        {
            if($(obj).attr('leve')==1) 
            {
                alert('不能超过五级！');
                $("#pid").get(0).selectedIndex=0;
            }
        }
        function deleImg(){
            $("#thumb").attr("value","");
        }
        
        $(function() {
        	$("#file_upload").uploadify({
        		height        : 22,
        		swf           : '__STATIC__/uploadify/uploadify.swf',
        		uploader      : '{:U("Upload/upload_tp")}',
        		width         : 60,
                multi         :false, //ture多文件，false单文件
                queueID:'uploadify_ppt',
                buttonText:'',
                removeCompleted : true,
                fileTypeDesc : '图片文件(*.jpg,*.jpeg,*.gif,*.png)',
                fileTypeExts : '*.jpg;*.jpeg;*.gif;*.png',
                'onUploadSuccess':function(file,data,response){
                        $('#thumb').val(data);
                        $('#img').attr('src',data);
                }
        	});
        });
        $(function(){
                var url1="{:U('Upload/upload_ke_json','',0)}";
                var url2="{:U('Upload/upload_ke_manager','',0)}";
                var editor;
    			KindEditor.ready(function(K) {
    				editor = K.create('.elem1', {
                        uploadJson : url1,
                        fileManagerJson : url2,
                        allowFileManager : true
    				});
    			});
        }); 
        function tab_f(x,_this){
            $('.tab span').removeClass('tab-c');
            if(x==1){
                $('#tab_body_1').css('display','');
                $('#tab_body_2').css('display','none');
                $(_this).addClass('tab-c');
            }
            else{
                $('#tab_body_2').css('display','');
                $('#tab_body_1').css('display','none');
                $(_this).addClass('tab-c');
            }
        }
    </script>
    
    <style type="text/css">
        .lock span{float:left;height:30px;line-height:30px;font-weight: normal;}
        .lock input{float:left;border: 0px;background: #f8f8f8;}
        
        .uplods{list-style-type: none;margin:0px;padding:0px;}
        .uplods li{float:left;margin:0px;padding:0px;margin-right:5px;}
        #thumb{font-size: 12px;width:145px;}
        
    </style>
</head>
<body>
<form action="{:U('Category/addHandle')}" enctype="multipart/form-data" method="post">
    <div class="top">
        <div class="position"><span class="icon icon-31"></span>当前位置：添加分类</div>
        <div class="top-title">
            <span class="icon icon-32"></span>
            <div class="top-tool">
                <a href="{:U('Category/index')}" class="button-a">返回列表</a>
                <input type="submit" class="button-b" value="提交保存"/>
            </div>
        </div>
    </div>
    <div class="body">
        <div class="tab">
            <span class="tab-c" onclick="tab_f(1,this)">基本</span>
            <span onclick="tab_f(2,this)">高级</span>
        </div>
        <div id="tab_body_1">
            <table class="list-tb tableTd" border="0" cellpadding="0" cellspacing="4">
              <tr>
                <td width="10%" class="textRight">上级类目：</td>
                    <td>
                        <select name="pid" id="pid" onclick="cc(this[selectedIndex]);">
                              <option value ="0">作为顶级类目</option>
                              <foreach name="Category" item="v">
                                 <option value ="{$v['id']}">{$v['title']}</option>
                                 <foreach name="v.child" item="v1">
                                    <option value ="{$v1['id']}">|-{$v1['title']}</option>
                                    <foreach name="v1.child" item="v2">
                                        <option value ="{$v2['id']}">|--{$v2['title']}</option>
                                        <foreach name="v2.child" item="v3">
                                            <option value ="{$v3['id']}" >|---{$v3['title']}</option>
                                            <foreach name="v3.child" item="v4">
                                                <option value ="{$v4['id']}" leve="1">|----{$v4['title']}</option>
                                            </foreach>
                                        </foreach>
                                    </foreach>
                                 </foreach>
                              </foreach>
                        </select>
                    </td>
                </tr>
                 <tr>
                    <td class="textRight">类目名称：</td>
                    <td>
                        <input type="text" name="title"/><span class="remark">最大可输入50个字符,支持中英文</span>
                    </td>
                </tr>
                <tr>
                    <td  class="textRight">类目扩展名称：</td>
                    <td>
                        <input type="text" name="retitle"/><span class="remark">其他名称,字段名：retitle</span>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">关键字：</td>
                    <td>
                        <input type="text" name="keywords"/><span class="remark">本栏目的关键字</span>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">排序：</td>
                    <td>
                        <input type="text" name="orders" value="0"/>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">访问权限：</td>
                    <td>
                        <select name="access">
                            <option value="1">游客</option>
                            <option value="2">会员</option>
                            <option value="3">禁止访问</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">评论权限：</td>
                    <td>
                        <select name="review">
                            <option value="1">游客</option>
                            <option value="2">会员</option>
                            <option value="3">禁止评论</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">发布权限：</td>
                    <td>
                        <select name="release">
                            <option value="0">游客</option>
                            <option selected="" value="1">会员</option>
                            <option value="2">禁止发布</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">是否显示：</td>
                    <td class="lock">
                            <input type="radio" name="show" value="0" checked=""/><span>显示</span>
                            <input type="radio" name="show" value="1"/><span>隐藏</span>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">模型：</td>
                    <td>
                        <select name="module">
                            <option value="">选择模型</option>
                            <foreach name="Module" item="v">
                                <option value ="{$v['tag']}">{$v['title']}</option>
                            </foreach>
                        </select>
                        
                    </td>
                </tr>
                <tr>
                    <td class="textRight">列表页：</td>
                    <td>
                            <input type="text" name="list" value="list"/><span class="remark">进入本分类，会调用该名称的列表页</span>
                    </td>
                </tr>
                <tr>
                    <td  class="textRight">内容页：</td>
                    <td>
                            <input type="text" name="content" value="content"/><span class="remark">进入本分类，会调用该名称的内容页</span>
                    </td>
                </tr>
                 <tr>
                    <td rowspan="2" class="textRight">分类图片：</td>
                    <td><img id="img" width="30px" height="30px" src="__PUBLIC__/images/imgs.gif"/></td>
                </tr>
                <tr>
                    <td>
                        <ul class="uplods">
                            <li><input type="text" name="thumb" id="thumb"/></li>
                            <li><input type="file" name="file_upload" id="file_upload"/></li>
                            <li><div id="uploadify_ppt" style="width: 300px;"></div></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td class="textRight">类目简介：</td>
                    <td>
                        <textarea name="description"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div  id="tab_body_2" style="display:none;padding-top:10px;">
            <table>
                <tr>
                    <td class="textRight" width="10%" valign="top" style="font-size: 12px;font-weight: bold;">详细：</td>
                    <td><textarea style="width: 700px;height:300px;" class="elem1" name="body"></textarea></td>
                </tr>
            </table>
            
        </div>     
    </div>
</form>
</body>
</html>